xshell 1.0.204 → 1.0.205

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/process.js +8 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xshell",
3
- "version": "1.0.204",
3
+ "version": "1.0.205",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {
package/process.js CHANGED
@@ -7,6 +7,12 @@ export const platform = os.platform();
7
7
  export const username = os.userInfo().username;
8
8
  export const noprint = { print: false };
9
9
  export const print_no_command = { print: { command: false, code: false, stdout: true, stderr: true } };
10
+ function get_command(exe, args) {
11
+ return (short_exe_names[exe] || exe.quote_if_space()) +
12
+ (args.length
13
+ ? ' ' + args.map(arg => arg.quote_if_space()).join(' ')
14
+ : '');
15
+ }
10
16
  async function prepare_spawn(detached, exe, args, { cwd, window: _window = true, envs,
11
17
  // @ts-ignore
12
18
  input, fp_stdin, fp_stdout, fp_stderr, print = true, proxy,
@@ -78,13 +84,7 @@ stdio }) {
78
84
  };
79
85
  let command;
80
86
  if (print.command)
81
- console.log((command =
82
- (short_exe_names[exe] || exe.quote_if_space()) +
83
- (args.length
84
- ? ' ' + args
85
- .map(arg => arg.quote_if_space())
86
- .join(' ')
87
- : '')).blue);
87
+ console.log((command = get_command(exe, args)).blue);
88
88
  return {
89
89
  print,
90
90
  command,
@@ -193,7 +193,7 @@ export async function call(exe, args = [], options = {}) {
193
193
  let message;
194
194
  const code_error = throw_code && (code || signal);
195
195
  if (print.code || code_error) {
196
- message = `进程 ${command} ` + (code
196
+ message = `进程 ${command || get_command(exe, args)} ` + (code
197
197
  ? `${throw_code ? '异常' : ''}结束,退出码: ${code}${signal ? `,信号: ${signal}` : ''}`
198
198
  : '正常结束');
199
199
  console.log(message[code_error ? 'red' : 'blue']);