• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript child_process.ChildProcess类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中child_process.ChildProcess的典型用法代码示例。如果您正苦于以下问题:TypeScript ChildProcess类的具体用法?TypeScript ChildProcess怎么用?TypeScript ChildProcess使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ChildProcess类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: Promise

    return new Promise((resolve: Function, reject: Function): void => {

        std.log('[TSC] compile => ' + path);

            let childProcess: ChildProcess = spawn('tsc', [], path);

            childProcess.stdout.on('data', (data: Buffer) => {
                std.log('[TSC] ' + data.toString());
            });

            childProcess.stderr.on('error', (data: Buffer) => {
                std.error('[TSC] ' + data.toString());
            });

            childProcess.on('error', reject);

            childProcess.on('close', (code) => {

                if (code !== 0) {
                    std.error(`[TSC] process exited with code ${code}`);
                } else {
                    std.log('[TSC] Files compiled');
                }

                resolve();
            });

    });
开发者ID:Romakita,项目名称:e2e-app,代码行数:28,代码来源:tsc.ts


示例2: resolve

    return new Promise<string>((resolve, reject) => {
        let childprocess: ChildProcess;
        try {
            childprocess = spawn('mono', ['--version'], { env: environment });
        }
        catch (e) {
            return resolve(undefined);
        }

        childprocess.on('error', function (err: any) {
            resolve(undefined);
        });

        let stdout = '';
        childprocess.stdout.on('data', (data: NodeBuffer) => {
            stdout += data.toString();
        });

        childprocess.stdout.on('close', () => {
            let match = versionRegexp.exec(stdout);

            if (match && match.length > 1) {
                resolve(match[1]);
            }
            else {
                resolve(undefined);
            }
        });
    });
开发者ID:gregg-miskelly,项目名称:omnisharp-vscode,代码行数:29,代码来源:getMonoVersion.ts


示例3: resolve

    return new Promise<boolean>((resolve, reject) => {
        let childprocess: ChildProcess;
        try {
            childprocess = spawn('mono', ['--version']);
        }
        catch (e) {
            return resolve(false);
        }

        childprocess.on('error', function (err: any) {
            resolve(false);
        });

        let stdout = '';
        childprocess.stdout.on('data', (data: NodeBuffer) => {
            stdout += data.toString();
        });

        childprocess.stdout.on('close', () => {
            let match = versionRegexp.exec(stdout),
                ret: boolean;

            if (!match) {
                ret = false;
            }
            else if (!range) {
                ret = true;
            }
            else {
                ret = satisfies(match[1], range);
            }

            resolve(ret);
        });
    });
开发者ID:peterblazejewicz,项目名称:omnisharp-vscode,代码行数:35,代码来源:launcher.ts


示例4: spawn

    return new Promise<any>((resolve: Function, reject: Function) => {
        const chromeDriver = `${ROOT}\node_modules\protractor\selenium\chromedriver_2.21.exe`;

        if(!Fs.existsSync(chromeDriver)){

            let childProcess: ChildProcess = spawn("node", [PROTRACTOR_INSTALL, "update"]);

            childProcess.stdout.on("data", (data) => {
                std.log(data.toString());
            });

            childProcess.stderr.on("data", (data) => {
                std.error('[INSTALL] '+data.toString());
            });

            childProcess.on("error", (data) => {
                std.error('[INSTALL] '+data.toString());
            });

            childProcess.on('close', resolve);

        } else {
            resolve();
        }
    });
开发者ID:Romakita,项目名称:e2e-app,代码行数:25,代码来源:protractor.ts


示例5: resolve

 return new Promise<Success | Error>(resolve => {
     const processProcessEnding = (code: number) => {
         resolve({
             success: true,
             code,
             stdout,
             stderr
         });
     };
     // If some error happens, then the "error" and "close" events happen.
     // If the process ends, then the "exit" and "close" events happen.
     // It is known that the order of events is not determined.
     let processExited = false;
     let processClosed = false;
     process.on('error', (error: any) => {
         outputChannel.appendLine(`error: error=${error}`);
         resolve({ success: false });
     });
     process.on('close', (code, signal) => {
         outputChannel.appendLine(`\nclose: code=${code}, signal=${signal}`);
         processClosed = true;
         if (processExited) {
             processProcessEnding(code);
         }
     });
     process.on('exit', (code, signal) => {
         outputChannel.appendLine(`\nexit: code=${code}, signal=${signal}`);
         processExited = true;
         if (processClosed) {
             processProcessEnding(code);
         }
     });
 });
开发者ID:KalitaAlexey,项目名称:RustyCode,代码行数:33,代码来源:OutputChannelProcess.ts


示例6: cb

  runScript(script: string, cb: {(err: Error | null, res: any)}) {
    const args = this.args.concat([script.trim()])
    const scr = this.scr = spawn(this.command, args)
    let output = {
      stdout: '',
      stderr: ''
    }
    scr.stdout.setEncoding('utf8')
    scr.stderr.setEncoding('utf8')
    scr.stdout.on('data', (d) => {
      output.stdout += d
    })
    scr.stderr.on('data', (d) => {
      output.stderr += d
    })

    scr.on('error', (err) => {
      if (this.stopped) return
      if (this.cbCalled) return
      this.cbCalled = true
      return cb(err, null)
    })
    scr.on('exit', (exitCode, signal) => {
      if (this.stopped) return
      if (this.cbCalled) return
      this.cbCalled = true
      if (exitCode !== 0) return cb(new Error(`script exited with non-zero exit code: ${exitCode} signal: ${signal}`), this.truncateOutput(output))
      cb(null, this.truncateOutput(output))
    })
  }
开发者ID:instructure,项目名称:ftl-engine,代码行数:30,代码来源:script.ts


示例7: onUpdateClick

function onUpdateClick() {
  if (serverProcess != null) return;

  refreshButton.disabled = true;
  installOrUninstallButton.disabled = true;
  updateButton.disabled = true;

  const systemId = treeView.selectedNodes[0].dataset["systemId"];
  const system = registry.systems[systemId];

  serverProcess = forkServerProcess([ "update", systemId, "--force", `--download-url=${system.downloadURL}` ]);
  progressLabel.textContent = `Running...`;

  serverProcess.on("message", onOperationProgress);
  serverProcess.on("exit", (statusCode: number) => {
    serverProcess = null;
    progressLabel.textContent = "";

    if (statusCode === 0) {
      system.localVersion =  system.version;
      updateSystemLabel(systemId);
    }

    refreshButton.disabled = false;
    onSelectionChange();
  });
}
开发者ID:saucyfai,项目名称:superpowers-app,代码行数:27,代码来源:systems.ts


示例8: runDiagnosticsWorker

function runDiagnosticsWorker(context: BuildContext) {
  if (!diagnosticsWorker) {
    const workerModule = path.join(__dirname, 'transpile-worker.js');
    diagnosticsWorker = fork(workerModule, [], { env: { FORCE_COLOR: true } });

    Logger.debug(`diagnosticsWorker created, pid: ${diagnosticsWorker.pid}`);

    diagnosticsWorker.on('error', (err: any) => {
      Logger.error(`diagnosticsWorker error, pid: ${diagnosticsWorker.pid}, error: ${err}`);
      workerEvent.emit('DiagnosticsWorkerDone');
    });

    diagnosticsWorker.on('exit', (code: number) => {
      Logger.debug(`diagnosticsWorker exited, pid: ${diagnosticsWorker.pid}`);
      diagnosticsWorker = null;
    });

    diagnosticsWorker.on('message', (msg: TranspileWorkerMessage) => {
      workerEvent.emit('DiagnosticsWorkerDone');
    });
  }

  const msg: TranspileWorkerMessage = {
    rootDir: context.rootDir,
    buildDir: context.buildDir,
    configFile: getTsConfigPath(context)
  };
  diagnosticsWorker.send(msg);
}
开发者ID:Kode-Kitchen,项目名称:ionic-app-scripts,代码行数:29,代码来源:transpile.ts


示例9: Promise

 let childPromise = new Promise((resolve, reject) => {
     child.on("error", e => result.error = e);
     child.on("exit", (exit_code: number) => {
         result.exit_code = exit_code;
         resolve();
     });
 });
开发者ID:KnisterPeter,项目名称:gerrit-vscode,代码行数:7,代码来源:exec.ts


示例10: Observable

 return new Observable((observer: Subscriber<Actions>) => {
   spawn.on("error", error => {
     // We both set the state and make it easy for us to log the error
     observer.next(
       actions.setExecutionState({
         kernelStatus: "process errored",
         kernelRef: action.payload.kernelRef
       })
     );
     observer.error({ type: "ERROR", payload: error, err: true });
     observer.complete();
   });
   spawn.on("exit", () => {
     observer.next(
       actions.setExecutionState({
         kernelStatus: "process exited",
         kernelRef: action.payload.kernelRef
       })
     );
     observer.complete();
   });
   spawn.on("disconnect", () => {
     observer.next(
       actions.setExecutionState({
         kernelStatus: "process disconnected",
         kernelRef: action.payload.kernelRef
       })
     );
     observer.complete();
   });
 });
开发者ID:nteract,项目名称:nteract,代码行数:31,代码来源:zeromq-kernels.ts



注:本文中的child_process.ChildProcess类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript child_process.exec类代码示例发布时间:2022-05-24
下一篇:
TypeScript child_process.spawnSync函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap