Skip to content

zombie process either by process.kill or pty.destroy #58

@hayeah

Description

@hayeah

This is the same problem as seen in #8 (which is closed).

The following spawns a bash shell every 3 seconds, and destroys each one after 500ms. It leaves behind a bunch of zombie processes.

PTY = require("pty.js")

console.log "Process: #{process.pid}"

bash = ->
  pty = PTY.spawn("bash",[],{
    name: 'xterm-color'
    cwd: process.cwd()
    env: process.env
  })

  setTimeout (->
    console.log "kill", pty.pid
    # Both of the following leave zombie processes
    # process.kill(pty.pid,"SIGTERM")
    # process.kill(pty.pid,"SIGHUP")
    pty.destroy()
  ), 500

setInterval (-> bash()), 3000

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions