[Scilab-users] unix_w(WSCI+"\bin\scilex --help") returns nothing

classic Classic list List threaded Threaded
7 messages Options
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] unix_w(WSCI+"\bin\scilex --help") returns nothing

Hello,

I have just discovered that, since Scilab 6.0.0, at least for windows users (not tested on Linux), the scilex.exe scilab binary file can be run with new undocumented options.
Noticeably, the "--help" one, that shows a list. From a cmd.exe shell:

>.\Scilab-6.0.2\bin\scilex --help
Usage: Scilab <options>
      -e Instruction   : execute the scilab instruction given in Instruction argument.
                         -e and -f arguments are mutually exclusive.
      -f File          : execute the scilab script given in File argument.
                         -e and -f arguments are mutually exclusive.
      -quit            : force scilab exit after execution of script from -e or -f argument.
                         this flag is ignored if it is not used with -e or -f argument.
      -l lang          : Change the language of scilab ( default : en_US ).
      -nw              : Enable console mode.
      -nwni            : Enable terminal mode.
      -ns              : Don't execute etc/scilab.start.
      --help           : Display this help.
      -scihome <dir>   : Force SCIHOME to <dir>.
Developer Trace arguments:
      --parse-trace    : Display bison state machine evolution.
      --AST-trace      : Display ASCII-art AST to be human readable.
      --pretty-print   : Display pretty-printed code, standard Scilab syntax.

Developer Timer arguments:
      --AST-timed      : Time each AST node.
      --timed          : Time global execution.

Developer Debug arguments:
      --no-exec        : Only do Lexing/parsing do not execute instructions.
      --context-dump   : Display context status.
      --exec-verbose   : Display command before running it.
      --timeout delay  : Kill the Scilab process after a delay.

However, if i try to run this command from Scilab through a unix_*() function, it  returns nothing.
Nothing in the Scilab session, nothing in the consolebox...:

--> unix_w(WSCI+"\bin\scilex --help")
--> [re,s,e] = unix_g(SCI+"\bin\scilex --help")
 e  = 

 s  =
   0.

 re  =
    []

There is no space in my WSCI path.
This behavior looks like the bug 14143 reported for Linux, not confirmed for Windows, and fixed in Scilab 6.0.2.

Any confirmation or explanation would be welcome.
Regards
Samuel








_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Chin Luh Tan Chin Luh Tan
Reply | Threaded
Open this post in threaded view
|

Re: unix_w(WSCI+"\bin\scilex --help") returns nothing

Hi Samuel, 

I think we could use this instead:

unix_w("Scilex --help  2>&1")


As you mentioned, the "--help" is Scilab 6 dedicated "hardcoded" function, I am yet to look for where is it located from the source, if anyone find out, please share here :).

For some reason, the output message seems  to have sent to stderr(2) instead of stdout(1), so we have to redirect it back to stdout for the unix_? to capture it. 

Similar case happened to Linux.

Thanks.

Regards,
Chin Luh



---- On Wed, 30 Oct 2019 01:33:47 +0800 Samuel Gougeon <[hidden email]> wrote ----

Hello,

I have just discovered that, since Scilab 6.0.0, at least for windows users (not tested on Linux), the scilex.exe scilab binary file can be run with new undocumented options.
Noticeably, the "--help" one, that shows a list. From a cmd.exe shell:

>.\Scilab-6.0.2\bin\scilex --help
Usage: Scilab <options>
      -e Instruction   : execute the scilab instruction given in Instruction argument.
                         -e and -f arguments are mutually exclusive.
      -f File          : execute the scilab script given in File argument.
                         -e and -f arguments are mutually exclusive.
      -quit            : force scilab exit after execution of script from -e or -f argument.
                         this flag is ignored if it is not used with -e or -f argument.
      -l lang          : Change the language of scilab ( default : en_US ).
      -nw              : Enable console mode.
      -nwni            : Enable terminal mode.
      -ns              : Don't execute etc/scilab.start.
      --help           : Display this help.
      -scihome <dir>   : Force SCIHOME to <dir>.
Developer Trace arguments:
      --parse-trace    : Display bison state machine evolution.
      --AST-trace      : Display ASCII-art AST to be human readable.
      --pretty-print   : Display pretty-printed code, standard Scilab syntax.

Developer Timer arguments:
      --AST-timed      : Time each AST node.
      --timed          : Time global execution.

Developer Debug arguments:
      --no-exec        : Only do Lexing/parsing do not execute instructions.
      --context-dump   : Display context status.
      --exec-verbose   : Display command before running it.
      --timeout delay  : Kill the Scilab process after a delay.

However, if i try to run this command from Scilab through a unix_*() function, it  returns nothing.
Nothing in the Scilab session, nothing in the consolebox...:

--> unix_w(WSCI+"\bin\scilex --help")
--> [re,s,e] = unix_g(SCI+"\bin\scilex --help")
 e  = 

 s  =
   0.

 re  =
    []

There is no space in my WSCI path.
This behavior looks like the bug 14143 reported for Linux, not confirmed for Windows, and fixed in Scilab 6.0.2.

Any confirmation or explanation would be welcome.
Regards
Samuel







_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: unix_w(WSCI+"\bin\scilex --help") returns nothing

Hello Chin Luh,

Le 30/10/2019 à 02:33, Chin Luh Tan a écrit :
Hi Samuel, 

I think we could use this instead:

unix_w("Scilex --help  2>&1")
It works perfectly. Thanks.

I have tried the same workaround for another MSDOS command, but unfortunately it does not work:
--> unix_w("chcp")
--> unix_w("chcp  2>&1")

Regards
Samuel


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Chin Luh Tan Chin Luh Tan
Reply | Threaded
Open this post in threaded view
|

Re: unix_w(WSCI+"\bin\scilex --help") returns nothing

Hi Samuel, 

try unix_w('chcp 0>&1')

i don't know why, 0 is the stdin, I am not sure why this works. perhaps some one can explain?

Thanks.

Regards,
Chin Luh


---- On Wed, 30 Oct 2019 18:48:22 +0800 Samuel Gougeon <[hidden email]> wrote ----

Hello Chin Luh,

Le 30/10/2019 à 02:33, Chin Luh Tan a écrit :
Hi Samuel, 

I think we could use this instead:

unix_w("Scilex --help  2>&1")
It works perfectly. Thanks.

I have tried the same workaround for another MSDOS command, but unfortunately it does not work:
--> unix_w("chcp")
--> unix_w("chcp  2>&1")

Regards
Samuel

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: unix_w(WSCI+"\bin\scilex --help") returns nothing

Le 30/10/2019 à 14:45, Chin Luh Tan a écrit :
> unix_w('chcp 0>&1')

Aa! Fortunately, there are only 3 standard streams to untangle...! But,
agreed, this case is rather special.
chcp usually expects an input arg, but this syntax does a query and does
not provide any input...
Anyway, in case of no answer, let's keep in mind that the content of
standard streams is not always where we expect it to be.
Thanks again.

Samuel

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: unix_w(WSCI+"\bin\scilex --help") returns nothing

In reply to this post by Chin Luh Tan
Le 30/10/2019 à 02:33, Chin Luh Tan a écrit :
Hi Samuel, 

I think we could use this instead:

unix_w("Scilex --help  2>&1")


As you mentioned, the "--help" is Scilab 6 dedicated "hardcoded" function, I am yet to look for where is it located from the source, if anyone find out, please share here :).

For some reason, the output message seems  to have sent to stderr(2) instead of stdout(1), so we have to redirect it back to stdout for the unix_? to capture it.

The whole thing is to know which reason. Clearly,  std::cerr is intentionally targeted,
in the source file \scilab\modules\startup\src\cpp\scilab.cpp:
static void usage(void)
{
    std::cerr << "Usage: Scilab <options>" << std::endl;
    std::cerr << "      -e Instruction   : execute the scilab instruction given in Instruction argument." << std::endl;
    std::cerr << "                         -e and -f arguments are mutually exclusive." << std::endl;
    std::cerr << "      -f File          : execute the scilab script given in File argument." << std::endl;
    std::cerr << "                         -e and -f arguments are mutually exclusive." << std::endl;
    std::cerr << "      -quit            : force scilab exit after execution of script from -e or -f argument." << std::endl;
    std::cerr << "                         this flag is ignored if it is not used with -e or -f argument." << std::endl;
    std::cerr << "      -l lang          : Change the language of scilab ( default : en_US )." << std::endl;
    std::cerr << "      -nw              : Enable console mode." << std::endl;
    std::cerr << "      -nwni            : Enable terminal mode." << std::endl;
    std::cerr << "      -ns              : Don't execute etc/scilab.start." << std::endl;
    std::cerr << "      --help           : Display this help." << std::endl;
    std::cerr << "      -scihome <dir>   : Force SCIHOME to <dir>." << std::endl;
    std::cerr << "Developer Trace arguments:" << std::endl;
    std::cerr << "      --parse-trace    : Display bison state machine evolution." << std::endl;
    std::cerr << "      --AST-trace      : Display ASCII-art AST to be human readable." << std::endl;
    std::cerr << "      --pretty-print   : Display pretty-printed code, standard Scilab syntax." << std::endl;
    std::cerr << " " << std::endl;
    std::cerr << "Developer Timer arguments:" << std::endl;
    std::cerr << "      --AST-timed      : Time each AST node." << std::endl;
    std::cerr << "      --timed          : Time global execution." << std::endl;
    std::cerr << " " << std::endl;
    std::cerr << "Developer Debug arguments:" << std::endl;
    std::cerr << "      --no-exec        : Only do Lexing/parsing do not execute instructions." << std::endl;
    std::cerr << "      --context-dump   : Display context status." << std::endl;
    std::cerr << "      --exec-verbose   : Display command before running it." << std::endl;
    std::cerr << "      --timeout delay  : Kill the Scilab process after a delay." << std::endl;
}


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Chin Luh Tan Chin Luh Tan
Reply | Threaded
Open this post in threaded view
|

Re: unix_w(WSCI+"\bin\scilex --help") returns nothing

fantastic, thanks for pointing this out!

rgds,
Chin Luh


---- On Thu, 31 Oct 2019 04:16:04 +0800 Samuel Gougeon <[hidden email]> wrote ----

Le 30/10/2019 à 02:33, Chin Luh Tan a écrit :
Hi Samuel, 

I think we could use this instead:

unix_w("Scilex --help  2>&1")


As you mentioned, the "--help" is Scilab 6 dedicated "hardcoded" function, I am yet to look for where is it located from the source, if anyone find out, please share here :).

For some reason, the output message seems  to have sent to stderr(2) instead of stdout(1), so we have to redirect it back to stdout for the unix_? to capture it.

The whole thing is to know which reason. Clearly,  std::cerr is intentionally targeted,
in the source file \scilab\modules\startup\src\cpp\scilab.cpp:
static void usage(void)
{
    std::cerr << "Usage: Scilab <options>" << std::endl;
    std::cerr << "      -e Instruction   : execute the scilab instruction given in Instruction argument." << std::endl;
    std::cerr << "                         -e and -f arguments are mutually exclusive." << std::endl;
    std::cerr << "      -f File          : execute the scilab script given in File argument." << std::endl;
    std::cerr << "                         -e and -f arguments are mutually exclusive." << std::endl;
    std::cerr << "      -quit            : force scilab exit after execution of script from -e or -f argument." << std::endl;
    std::cerr << "                         this flag is ignored if it is not used with -e or -f argument." << std::endl;
    std::cerr << "      -l lang          : Change the language of scilab ( default : en_US )." << std::endl;
    std::cerr << "      -nw              : Enable console mode." << std::endl;
    std::cerr << "      -nwni            : Enable terminal mode." << std::endl;
    std::cerr << "      -ns              : Don't execute etc/scilab.start." << std::endl;
    std::cerr << "      --help           : Display this help." << std::endl;
    std::cerr << "      -scihome <dir>   : Force SCIHOME to <dir>." << std::endl;
    std::cerr << "Developer Trace arguments:" << std::endl;
    std::cerr << "      --parse-trace    : Display bison state machine evolution." << std::endl;
    std::cerr << "      --AST-trace      : Display ASCII-art AST to be human readable." << std::endl;
    std::cerr << "      --pretty-print   : Display pretty-printed code, standard Scilab syntax." << std::endl;
    std::cerr << " " << std::endl;
    std::cerr << "Developer Timer arguments:" << std::endl;
    std::cerr << "      --AST-timed      : Time each AST node." << std::endl;
    std::cerr << "      --timed          : Time global execution." << std::endl;
    std::cerr << " " << std::endl;
    std::cerr << "Developer Debug arguments:" << std::endl;
    std::cerr << "      --no-exec        : Only do Lexing/parsing do not execute instructions." << std::endl;
    std::cerr << "      --context-dump   : Display context status." << std::endl;
    std::cerr << "      --exec-verbose   : Display command before running it." << std::endl;
    std::cerr << "      --timeout delay  : Kill the Scilab process after a delay." << std::endl;
}

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users