You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Testing the latest change from version 8.1.9 to 8.2.0 we detected some unexpected change of behavior in the output of our scripts working with zx. I tried to reproduce the observed behavior in the following TS script, which I run with node --loader ts-node/esm --no-warnings=ExperimentalWarning testZx.ts and my node version is v20.10.0.
import{$,LogEntry}from"zx";await$`echo "$.verbose = ${$.verbose} & $.quiet = ${$.quiet}"`;//from this I infer what is the expected behavior for $.verbose = false and $.quiet = false$.verbose=true;await$`echo "$.verbose = ${$.verbose} & $.quiet = ${$.quiet}"`;//from this I infer what is the expected behavior for $.verbose = true and $.quiet = falseawait$`echo "$.verbose = ${$.verbose} & $.quiet = ${$.quiet} & .verbose(false)"`.verbose(false);//expected to output nothingawait$`echo "$.verbose = ${$.verbose} & $.quiet = ${$.quiet} & .quiet(true)"`.quiet(true);//expected to output nothing$.quiet=true;await$`echo "$.verbose = ${$.verbose} & $.quiet = ${$.quiet}"`;//expected to output nothingawait$`echo "$.verbose = ${$.verbose} & $.quiet = ${$.quiet} & .quiet(false)"`.quiet(false);//expected to output the zx command and its output$.verbose=false;await$`echo "$.verbose = ${$.verbose} & $.quiet = ${$.quiet} & .quiet(false)"`.quiet(false);//expected to output nothing$.verbose=true;$.log=(entry: LogEntry)=>{console.log(`entry.kind = ${entry.kind} & entry.verbose = ${entry.verbose}`);};$.quiet=false;await$`echo "Hello World"`;//expected to lead to entry.verbose = trueawait$`echo "Hello World"`.quiet();//expected to lead to entry.verbose = false
$.verbose = true & $.quiet = false & .verbose(false) have a different behavior as $.verbose = false and $.quiet = false
.quiet(true) does not suppress the zx command to be printed
.quiet(false) still suppresses the zx command to be printed
the entry.verbose for the cmd kind gets not changed to false anymore if .quiet() is used (this is crucial for us since in our logging function we want to suppress all output if .quiet is used)
For me this looks like an unintended behavior, or do I misperceive something?
The text was updated successfully, but these errors were encountered:
We've the fixed the internal process init logic, that previously blocked pid obtaining: in short cp.spawn is not wrapped with setImmediate workaround anymore.
$({quiet: true})cmd applies the option before the first log event may occur, meanwhile $cmd.quiet() modifies the behavior of the running process.
Testing the latest change from version 8.1.9 to 8.2.0 we detected some unexpected change of behavior in the output of our scripts working with zx. I tried to reproduce the observed behavior in the following TS script, which I run with
node --loader ts-node/esm --no-warnings=ExperimentalWarning testZx.ts
and my node version isv20.10.0
.With zx version 8.1.9 the output is:
Observations:
$.verbose = false
and$.quiet = false
output nothing$.verbose = true
and$.quiet = false
output the zx command and its outputWith zx version 8.2.0 we get this:
Observations:
$.verbose = true & $.quiet = false & .verbose(false)
have a different behavior as$.verbose = false
and$.quiet = false
For me this looks like an unintended behavior, or do I misperceive something?
The text was updated successfully, but these errors were encountered: