facebookarchive / nuclide

An open IDE for web and native mobile development, built on top of Atom
https://nuclide.io
Other
7.79k stars 682 forks source link

Can't start on FreeBSD #186

Open kentor opened 9 years ago

kentor commented 9 years ago
➜  stuff  nuclide-start-server
Traceback (most recent call last):
  File "scripts/nuclide_server_manager.py", line 244, in <module>
    manager.cleanup()
  File "scripts/nuclide_server_manager.py", line 127, in cleanup
    re.escape('forever/bin/monitor'), re.escape('nuclide-main.js'))):
  File "/usr/local/lib/node_modules/nuclide-server/scripts/process_info.py", line 92, in get_processes
    stdout = utils.check_output_silent(args)
  File "/usr/local/lib/node_modules/nuclide-server/scripts/utils.py", line 29, in check_output_silent
    raise error
subprocess.CalledProcessError: Command '['ps', '-o', 'pid,command', '-u', 'kentor']' returned non-zero exit status 1

I believe in FreeBSD the -u flag needs to be -U.

eneas commented 7 years ago

Changing -U for -u fixes it somehow in freebsd but I think it breaks macOS. In macOS -u is for ID and -U for username. It doesn't hurt much linux because -u is for effective user (name or ID) and -U for real user (name or ID). Anyway in freebsd there is another bug hidden by this.

$ /usr/local/bin/nuclide-start-server
Traceback (most recent call last):
  File "scripts/nuclide_server_manager.py", line 401, in <module>
    print(json.dumps(result))
  File "/usr/local/lib/python2.7/json/__init__.py", line 244, in dumps
    return _default_encoder.encode(obj)
  File "/usr/local/lib/python2.7/json/encoder.py", line 207, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/local/lib/python2.7/json/encoder.py", line 270, in iterencode
    return _iterencode(o, 0)
  File "/usr/local/lib/python2.7/json/encoder.py", line 184, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <logging.LogRecord object at 0x801962850> is not JSON serializable

I tracked it to nuclide_server_manager.py unabled to connect to the node https server. The node server is started but doesn't respond to nuclide_server_manager.py .

$ ps |grep nuclide
4282  3  S    0:00.44 node /usr/local/lib/node_modules/nuclide/pkg/nuclide-server/lib/nuclide-main.js --port 9090 --stack-trace-limit=50 --cert /home/freebsduser/.certs/nuclide._fNYjG.server.crt --key /ho

Using nuclide-start-server -k (unsecure http) doesn't have the same problem.

$ /usr/local/bin/nuclide-start-server -k
{"success": true, "version": "195", "pid": "4333", "port": 9091, "workspace": null}
The log file can be found at /tmp/nuclide-freebsduser-logs/server-start/nuclide-2017-01-07T03:35:30.nohup.out.
dezfx commented 7 years ago

On BSD, you have to pass -U instead of -u, and -w -w. The command column gets truncated otherwise. See man ps. I should probably go write a decent patch for this...