Skip to content

Commit c7ed841

Browse files
authored
Merge pull request #38 from Hugo1380/master
feat(run-dev): simplify `sudo` logic by checking user ID
2 parents 1bfe39a + 6f62729 commit c7ed841

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,11 @@ run-dev: build-dev
164164
if [ ! -e $(BASE_DIR)/dev/wigo.crt ]; then \
165165
(cd $(BASE_DIR)/dev && $(BASE_DIR)/release/current/generate_cert -ca=true -duration=87600h0m0s -host "127.0.0.1" --rsa-bits=4096;) \
166166
fi; \
167-
# Try without sudo first, use sudo only if needed
168-
$(BASE_DIR)/release/current/wigo --config $(BASE_DIR)/etc/wigo-dev.conf & \
169-
WIGO_PID=$$!; \
170-
sleep 1; \
171-
if ! kill -0 $$WIGO_PID 2>/dev/null; then \
167+
# Check if user is root, use sudo if not
168+
if [ $$(id -u) -eq 0 ]; then \
169+
$(BASE_DIR)/release/current/wigo --config $(BASE_DIR)/etc/wigo-dev.conf & \
170+
WIGO_PID=$$!; \
171+
else \
172172
sudo $(BASE_DIR)/release/current/wigo --config $(BASE_DIR)/etc/wigo-dev.conf & \
173173
WIGO_PID=$$!; \
174174
fi; \

0 commit comments

Comments
 (0)