Tag: pty

节点pty.js产生一个进程本身产生subprocess,并且当节点被杀时subprocess不会死

使用Ubuntu 13.10并运行节点v0.10.0。 我正在使用pty.js v0.2.4来生成一个程序(需要在交互式环境中运行)。 该程序是用C语言编写的,并自行分发一个subprocess。 我写了一个C程序(我称之为“forktest”)的一个非常简化的版本,它具有产生这个问题的最低要求,并包含以下内容: #include <unistd.h> #include <sys/types.h> #include <errno.h> #include <stdio.h> #include <sys/wait.h> #include <stdlib.h> int main(void) { pid_t childPID; childPID = fork(); if(childPID >= 0) { if(childPID == 0) { signal(SIGHUP, SIG_IGN); while(1) { printf("Child Process\n"); fflush(stdout); usleep(500000); } } else { printf("Parent process\n"); fflush(stdout); getchar(); } } else { printf("Fork […]

Nodejs setsid()等效

我试图在nodejs中执行一个bash shell – 除了作业控制,我还在工作。 我很确定这是因为产生的进程没有被设置给进程负责人。 在C中,我可以通过调用setsid()来做到这一点。 在nodejs中,我读了相当于在产生新进程时设置选项'setsid:true'。 我这样做是这样的: var child = spawn('/bin/bash', ['–login'], {stdio: [this.slave, this.slave, this.slave], env: {"TERM": "vt100"}, setsid: true}); 但是我仍然收到“在这个shell中没有作业控制”的消息。 示例输出,分配pty ttys002后: bash: no job control in this shell Amandas-MacBook-Pro:puffshell amanda$ tty /dev/ttys002 Amandas-MacBook-Pro:puffshell amanda$ Amandas-MacBook-Pro:puffshell amanda$ ps PID TTY TIME CMD 2055 ttys000 0:00.05 -bash 2158 ttys000 0:00.01 /bin/bash 2170 ttys000 […]

要启用并行构build,请添加“/ m”开关

我想运行这个示例https://github.com/Gottox/node-webterm ,但是当我执行命令npm安装它显示错误消息。 Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. exechelper.cpp ..\src\exechelper.cpp(3): fatal error C1083: Cannot open include file: 'unistd. h': No such file or directory [V:\node-webterm-master\node_modules\child_pty\bu ild\exechelper.vcxproj] pty.cpp ..\src\pty.cpp(25): error C2027: use of undefined type 'winsize' [V:\node-webte rm-master\node_modules\child_pty\build\pty.vcxproj] ..\src\pty.cpp(22) : see declaration of […]

在执行npm安装时发生node-gyp错误

我正在做一个项目的npm安装,我在node-gyp中得到这个奇怪的错误。 > pty.js@0.2.3 install /home/charizard/Open/terminal-codelearn/node_modules/pty.js > node-gyp rebuild npm http GET https://registry.npmjs.org/commander npm http GET https://registry.npmjs.org/nan npm http GET https://registry.npmjs.org/tinycolor npm http GET https://registry.npmjs.org/options gyp ERR! configure error gyp ERR! stack Error: "pre" versions of node cannot be installed, use the –nodedir flag instead gyp ERR! stack at install (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:65:16) gyp ERR! stack at Object.self.commands.(anonymous […]

在OS X上安装pty.js(节点)错误

尝试使用节点安装pty.js时,遇到了一个不常见的问题: 如果我运行npm install pty.js我收到这个错误: > node-gyp rebuild CXX(target) Release/obj.target/pty/src/unix/pty.o ../src/unix/pty.cc:487:10: error: use of undeclared identifier 'openpty' return openpty(amaster, aslave, name, (termios *)termp, (winsize *)winp); ^ ../src/unix/pty.cc:533:10: error: use of undeclared identifier 'forkpty' return forkpty(amaster, name, (termios *)termp, (winsize *)winp); ^ 2 errors generated. make: *** [Release/obj.target/pty/src/unix/pty.o] Error 1 gyp ERR! build error gyp ERR! stack […]