Skip to content

Commit 5dcf837

Browse files
committed
Survive a missing nohup, and say something useful when the proxy won't start
Found while testing the release-tarball path on a machine with no Homebrew — the path a non-technical user actually takes, and the one nothing had exercised until now (both real installs so far found an existing binary). The tarball path itself works: 59 MB binary downloaded, feature-gate satisfied, config written, GPT and Claude both answering through it, proxy cleaned up on exit. Two things it exposed: - start_proxy hard-depended on `nohup`. Present everywhere in practice, but a background job with the same redirect works without it, so fall back rather than failing. - "proxy failed to start — see proxy.log" pointed at an EMPTY log, which is precisely the case where the log cannot help: the binary never ran. The message now distinguishes the two and prints the command to run by hand.
1 parent aaec78b commit 5dcf837

1 file changed

Lines changed: 21 additions & 3 deletions

File tree

‎qbraid-code‎

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,16 @@ start_proxy() {
5050
echo "qbraid-code: proxy config missing — re-run the installer." >&2
5151
return 1
5252
}
53-
nohup "$PROXY_BIN" -config "$HOME_DIR/proxy-config.yaml" \
54-
>> "$HOME_DIR/proxy.log" 2>&1 &
53+
# `nohup` is POSIX and present everywhere in practice, but if it is missing
54+
# the redirect below still detaches well enough for our purposes — better a
55+
# working proxy than a hard failure over a missing convenience wrapper.
56+
if command -v nohup >/dev/null 2>&1; then
57+
nohup "$PROXY_BIN" -config "$HOME_DIR/proxy-config.yaml" \
58+
>> "$HOME_DIR/proxy.log" 2>&1 &
59+
else
60+
"$PROXY_BIN" -config "$HOME_DIR/proxy-config.yaml" \
61+
>> "$HOME_DIR/proxy.log" 2>&1 &
62+
fi
5563
i=0
5664
while [ "$i" -lt 40 ]; do
5765
if proxy_listening; then
@@ -61,7 +69,17 @@ start_proxy() {
6169
sleep 0.3
6270
i=$((i + 1))
6371
done
64-
echo "qbraid-code: proxy failed to start — see $HOME_DIR/proxy.log" >&2
72+
# An empty log is the confusing case: it means the binary never ran (missing
73+
# dependency, wrong architecture, quarantined) rather than failing on config.
74+
echo "qbraid-code: the GPT proxy did not start." >&2
75+
if [ -s "$HOME_DIR/proxy.log" ]; then
76+
echo "Last lines of $HOME_DIR/proxy.log:" >&2
77+
tail -5 "$HOME_DIR/proxy.log" >&2
78+
else
79+
echo "It produced no output at all — try running it directly to see why:" >&2
80+
echo " $PROXY_BIN -config $HOME_DIR/proxy-config.yaml" >&2
81+
fi
82+
echo "Claude models are unaffected; run qbraid-code without --model gpt-... " >&2
6583
return 1
6684
}
6785

0 commit comments

Comments
 (0)