Understanding the `--` (Double Dash) Separator in `slnodejs run` Commands

circle-info

One option for adding SeaLights to a Backend Node Server is to *wrap* the application's startup command with slnodejs , as detailed here. This article is specifically relevant to anyone using that approach. This article is not relevant if you are using Preload.js or if you are adding SeaLights to a Frontend Javascript application component.

What does -- mean in a shell command?

A standalone -- (double dash followed by a space) is a POSIX convention that signals "end of options." Everything after -- is treated as positional arguments, not as option flags — even if those arguments start with -.

This is a universal convention used across virtually all CLI tools. For example:

# Deletes a file literally named "-f" (without --, rm would interpret -f as a flag)
rm -- -f

# Checks out a file named "main" (without --, git might think it's a branch name)
git checkout -- main

How is -- different from --token or --labid?

They are two entirely different constructs:

Syntax
Meaning
Example

--option (no space)

A long-form option flag passed to the program

--token, --labid, --workspacepath

-- value (with space)

The argument separator — marks the end of options

-- server.js

How does slnodejs run use --?

In a slnodejs run command, the -- separator tells the Sealights agent: "I'm done passing options to you — everything that follows is the application entry point you should wrap."

exec ./node_modules/.bin/slnodejs run \
  --token "$SL_TOKEN" \
  --buildsessionidfile buildSessionId \
  --labid __SEALIGHTS_LAB_ID__ \
  --workspacepath "." \
  --useinitialcolor true \
  --useslnode2 \
  -- server.js
  • --token, --buildsessionidfile, --labid, etc. are options for slnodejs.

  • -- signals that options are done.

  • server.js is the application entry point that Sealights will wrap and run.

Should I include node after --?

No. The Sealights agent already invokes Node.js internally. The value after -- should only be the path to your application entry point.

Correct:

Incorrect:

What happens if I write -- node server.js?

The agent interprets node as the application entry point file. If the agent is active, this may appear to work in some cases. However, if the agent is disabled (e.g., due to a missing or invalid token), the fallback logic runs:

Since the first argument is node, this becomes:

Node.js then attempts to load a module called node from the working directory, resulting in an error like:

Last updated

Was this helpful?