Question: How can I add rows to a table with this structure using Javascript?

Basically I want to be able to click a button and have a new row created within the table for each of the columns used below. So for instance, it could be name: new book, quantity:30 etc.

```
<table id="dynamictable">
    <tbody>
        <tr>
            <td class="name">My Favorite book</td>
            <td class="quantity">x&nbsp;20</td>
            <td class="unit_price">£8.99</td>
            <td class="total">£179.80</td>
            <td class="remove">
                <img src="image/cross.png">
            </td>
        </tr>
    </tbody>
</table>

```

Answer: 
Here is the traditional unix way to see if a process is alive - send it a signal of 0 (like you did with your bash example).

From `kill(2)`:

> 
> 
> ```
>    If  sig  is 0, then no signal is sent, but error checking is still per‐
>    formed; this can be used to check for the existence of a process ID  or
>    process group ID.
> 
> ```
> 
> 

And translated into Go

```
package main

import (
    "fmt"
    "log"
    "os"
    "strconv"
    "syscall"
)

func main() {
    for _, p := range os.Args[1:] {
        pid, err := strconv.ParseInt(p, 10, 64)
        if err != nil {
            log.Fatal(err)
        }
        process, err := os.FindProcess(int(pid))
        if err != nil {
            fmt.Printf("Failed to find process: %s\n", err)
        } else {
            err := process.Signal(syscall.Signal(0))
            fmt.Printf("process.Signal on pid %d returned: %v\n", pid, err)
        }

    }
}

```

When you run it you get this, showing that process 123 is dead, process 1 is alive but not owned by you and process 12606 is alive and owned by you.

```
$ ./kill 1 $$ 123
process.Signal on pid 1 returned: operation not permitted
process.Signal on pid 12606 returned: <nil>
process.Signal on pid 123 returned: no such process

```
Here is one way of how to check if a process exists/running with Golang on Windows.

We execute the command:

```
TASKLIST /V /NH /FI "PID eq 23232"

```

Which can return either:

```
INFO: No tasks are running which match the specified criteria.

```

Or if found:

```
Image Name                     PID Session Name        Session#    Mem Usage Status          User Name                                              CPU Time Window Title                                                         
========================= ======== ================ =========== ============ =============== ================================================== ============ ========================================================================
chrome.exe                   23232 Console                    1     42,472 K Unknown         THANOS\MARVEL                                       0:00:00 N/A                                         

```

Here is a function that takes advantage of this information.

```
func isProcessRunning(pid int) bool {
    cmd := exec.Command("TASKLIST", "/FI", fmt.Sprintf("PID eq %d", pid))
    result, err := cmd.Output()
    if err != nil {
        return false
    }
    return !bytes.Contains(result, []byte("No tasks are running"))
}

```

The best thing about this is you can find the process by other parameters too:

```
ImageName   eq, ne                  Image Name String
PID         eq, ne, gt, lt, ge, le  Process ID, A Positive integer.
Session     eq, ne, gt, lt, ge, le  Any valid session number.
SessionName eq, ne                  String
Status      eq, ne                  RUNNING | NOT RESPONDING | UNKNOWN
CPUTime     eq, ne, gt, lt, ge, le  Time hh:mm:ss
MemUsage    eq, ne, gt, lt, ge, le  Memory usage in KB, specify a valid integer.
Username    eq, ne                  User name ([Domain\]User).
Services    eq, ne                  Service Name String
Windowtitle eq, ne                  Window Title String
Modules     eq, ne                  DLL Name String

```