Skip to content

Broken running forked livescript #916

Closed

Description

@fansgit

lsc 1.5.0 would be broken when running the following directly.

require! cluster

if cluster.is-master
  console.log \master
  cluster.fork!
else
  console.log \worker
  process.disconnect!
require! cluster
       ^
SyntaxError: Unexpected token !

Activity

  1. bumxu commented on Jul 31, 2016

    @bumxu

    This has been introduced by #562.
    process.execPath now points to Node, so fork is executed as JS.

    I can't think a clear solution, sometimes we need execPath pointing node, sometimes pointing lsc.

    😲

  2. rhendric commented on Mar 29, 2017

    @rhendric
    Collaborator

    As I see it, the problem here is not that execPath needs to point to lsc; it's that lsc shouldn't be messing around with process.argv. If I remove the code from command.ls and node.ls that does so, this example works fine, and I bet the shelljs functionality fixed in #562 also continues to work.

    The node.ls behavior was introduced in commit 9090c59, way back in the coco days. The motivation stated in that commit was to make relative require work with --eval and --stdin. Removing the process.argv assignment from that code doesn't seem to break relative require with --eval or --stdin when I tested it.

    The command.ls behavior was introduced in response to #569, in commit c959444. This is partly a case of piling a hack on top of the previous hack, and partly a case of asking for the wrong thing: the reporter asked for [ 'node', '/home/derk/test.ls', 'hello' ] but should have asked for [ 'node', 'lsc', '/home/derk/test.ls', 'hello' ] (or [ 'lsc', '/home/derk/test.ls', 'hello' ], but we know thanks to #562 that this has undesirable effects).

    Basically, I think both of those hacks should be removed and process.argv should be left as node intended.

  3. added a commit that references this issue on Mar 29, 2017
    e80ccbb
  4. added a commit that references this issue on May 8, 2017
    03c6e6a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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