# job_run

- **Language:** C
- **Kind:** function
- **Source:** https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/job.c#L72
- **Page:** https://libtmux.org/en/tmux/3.7c/reference/c-function-job_run/

```c
struct job * job_run(const char *cmd, int argc, char **argv, struct environ *e, struct session *s, const char *cwd, job_update_cb updatecb, job_complete_cb completecb, job_free_cb freecb, void *data, int flags, int sx, int sy)
```

## Parameters

- `cmd` (`const char *`)
- `argc` (`int`)
- `argv` (`char **`)
- `e` (`struct environ *`)
- `s` (`struct session *`)
- `cwd` (`const char *`)
- `updatecb` (`job_update_cb`)
- `completecb` (`job_complete_cb`)
- `freecb` (`job_free_cb`)
- `data` (`void *`)
- `flags` (`int`)
- `sx` (`int`)
- `sy` (`int`)

## Called by

- [`cmd_if_shell_exec`](/en/tmux/3.7c/reference/c-function-cmd-if-shell-c-cmd_if_shell_exec/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-if-shell.c#L121)
- [`cmd_run_shell_timer`](/en/tmux/3.7c/reference/c-function-cmd-run-shell-c-cmd_run_shell_timer/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-run-shell.c#L208)
- [`format_job_get`](/en/tmux/3.7c/reference/c-function-format-c-format_job_get/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/format.c#L420)
- [`popup_display`](/en/tmux/3.7c/reference/c-function-popup_display/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/popup.c#L864)
- [`window_copy_pipe_run`](/en/tmux/3.7c/reference/c-function-window-copy-c-window_copy_pipe_run/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/window-copy.c#L5521)

## Calls

- [`checkshell`](/en/tmux/3.7c/reference/c-function-checkshell/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/job.c#L104)
- [`cmd_copy_argv`](/en/tmux/3.7c/reference/c-function-cmd_copy_argv/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/job.c#L188)
- [`cmd_log_argv`](/en/tmux/3.7c/reference/c-function-cmd_log_argv/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/job.c#L123)
- [`cmd_stringify_argv`](/en/tmux/3.7c/reference/c-function-cmd_stringify_argv/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/job.c#L205)
- [`environ_copy`](/en/tmux/3.7c/reference/c-function-environ_copy/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/job.c#L94)
- [`environ_for_session`](/en/tmux/3.7c/reference/c-function-environ_for_session/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/job.c#L92)
- [`environ_free`](/en/tmux/3.7c/reference/c-function-environ_free/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/job.c#L154)
- [`environ_push`](/en/tmux/3.7c/reference/c-function-environ_push/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/job.c#L153)
- [`environ_set`](/en/tmux/3.7c/reference/c-function-environ_set/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/job.c#L144)
- [`fatal`](/en/tmux/3.7c/reference/c-function-fatal/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/job.c#L150)
- [`fatalx`](/en/tmux/3.7c/reference/c-function-fatalx/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/job.c#L228)
- [`fdforkpty`](/en/tmux/3.7c/reference/c-function-fdforkpty/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/job.c#L116)
- [`log_debug`](/en/tmux/3.7c/reference/c-function-log_debug/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/job.c#L124)
- [`options_get_string`](/en/tmux/3.7c/reference/c-function-options_get_string/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/job.c#L103)
- [`proc_clear_signals`](/en/tmux/3.7c/reference/c-function-proc_clear_signals/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/job.c#L139)
- [`setblocking`](/en/tmux/3.7c/reference/c-function-setblocking/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/job.c#L223)
- [`shell_argv0`](/en/tmux/3.7c/reference/c-function-shell_argv0/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/job.c#L107)
- [`xcalloc`](/en/tmux/3.7c/reference/c-function-xcalloc/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/job.c#L198)
- [`xstrdup`](/en/tmux/3.7c/reference/c-function-xstrdup/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/job.c#L203)

## Other function references

- [`find_home`](/en/tmux/3.7c/reference/c-function-find_home/) (function)
- [`job_error_callback`](/en/tmux/3.7c/reference/c-function-job-c-job_error_callback/) (function)
- [`job_read_callback`](/en/tmux/3.7c/reference/c-function-job-c-job_read_callback/) (function)
- [`job_write_callback`](/en/tmux/3.7c/reference/c-function-job-c-job_write_callback/) (function)

## Referenced declarations

- [`_PATH_BSHELL`](/en/tmux/3.7c/reference/c-define-compat-h-_path_bshell/) (constant)
- [`_PATH_DEVNULL`](/en/tmux/3.7c/reference/c-define-compat-h-_path_devnull/) (constant)
- [`all_jobs`](/en/tmux/3.7c/reference/c-variable-job-c-all_jobs/) (attribute)
- [`cfg_finished`](/en/tmux/3.7c/reference/c-variable-cfg_finished/) (attribute)
- [`job.cmd`](/en/tmux/3.7c/reference/c-struct-job-cmd/) (attribute)
- [`job.completecb`](/en/tmux/3.7c/reference/c-struct-job-completecb/) (attribute)
- [`job.data`](/en/tmux/3.7c/reference/c-struct-job-data/) (attribute)
- [`environ`](/en/tmux/3.7c/reference/c-struct-environ/) (struct)
- [`job.event`](/en/tmux/3.7c/reference/c-struct-job-event/) (attribute)
- [`job.fd`](/en/tmux/3.7c/reference/c-struct-job-fd/) (attribute)
- [`job.flags`](/en/tmux/3.7c/reference/c-struct-job-flags/) (attribute)
- [`job.freecb`](/en/tmux/3.7c/reference/c-struct-job-freecb/) (attribute)
- [`global_s_options`](/en/tmux/3.7c/reference/c-variable-global_s_options/) (attribute)
- [`job`](/en/tmux/3.7c/reference/c-struct-job/) (struct)
- [`job_complete_cb`](/en/tmux/3.7c/reference/c-typedef-job_complete_cb/) (typealias)
- [`JOB_DEFAULTSHELL`](/en/tmux/3.7c/reference/c-define-tmux-h-job_defaultshell/) (constant)
- [`job_free_cb`](/en/tmux/3.7c/reference/c-typedef-job_free_cb/) (typealias)
- [`JOB_PTY`](/en/tmux/3.7c/reference/c-define-tmux-h-job_pty/) (constant)
- [`JOB_SHOWSTDERR`](/en/tmux/3.7c/reference/c-define-tmux-h-job_showstderr/) (constant)
- [`job_update_cb`](/en/tmux/3.7c/reference/c-typedef-job_update_cb/) (typealias)
- [`session.options`](/en/tmux/3.7c/reference/c-struct-session-options/) (attribute)
- [`job.pid`](/en/tmux/3.7c/reference/c-struct-job-pid/) (attribute)
- [`ptm_fd`](/en/tmux/3.7c/reference/c-variable-ptm_fd/) (attribute)
- [`server_proc`](/en/tmux/3.7c/reference/c-variable-server_proc/) (attribute)
- [`session`](/en/tmux/3.7c/reference/c-struct-session/) (struct)
- [`job.state`](/en/tmux/3.7c/reference/c-struct-job-state/) (attribute)
- [`job.status`](/en/tmux/3.7c/reference/c-struct-job-status/) (attribute)
- [`job.tty`](/en/tmux/3.7c/reference/c-struct-job-tty/) (attribute)
- [`TTY_NAME_MAX`](/en/tmux/3.7c/reference/c-define-compat-h-tty_name_max/) (constant)
- [`job.updatecb`](/en/tmux/3.7c/reference/c-struct-job-updatecb/) (attribute)
