Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:26
erlang
2103-erl-Set-noshell-when-S-is-used.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 2103-erl-Set-noshell-when-S-is-used.patch of Package erlang
From 95fafb852c7814e68590dbaa48bfe77e2fc949c7 Mon Sep 17 00:00:00 2001 From: Johannes Christ <jc@jchri.st> Date: Thu, 16 Nov 2023 18:31:14 +0100 Subject: [PATCH] erl: Set -noshell when -S is used Since the primary intended usecase for -S is command-line scripts such as the new "httpd serve", automatically add the "-noshell" flag to simplify noninteractive use. Remove a leading newline from the httpd serve startup output that was used to separate it from the shell prompt. As suggested in #7470. --- erts/doc/src/erl_cmd.xml | 1 + erts/etc/common/erlexec.c | 1 + lib/inets/src/http_server/httpd.erl | 2 +- lib/inets/test/httpd_serve_SUITE.erl | 4 ++-- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/erts/doc/src/erl_cmd.xml b/erts/doc/src/erl_cmd.xml index f840e816de..ccf72612a0 100644 --- a/erts/doc/src/erl_cmd.xml +++ b/erts/doc/src/erl_cmd.xml @@ -636,6 +636,7 @@ $ <input>erl \ <c><![CDATA[[Arg1,Arg2,...]]]></c> as argument, or an empty list if no arguments are passed. All further arguments occurring after this option are passed to the specified function as strings. + Implies <c><![CDATA[-noshell]]></c>. See <seeerl marker="init"> <c>init(3)</c></seeerl>.</p> </item> <tag><c><![CDATA[-run Mod [Func [Arg1, Arg2, ...]]]]></c> (init diff --git a/erts/etc/common/erlexec.c b/erts/etc/common/erlexec.c index 5f16586696..854e30406b 100644 --- a/erts/etc/common/erlexec.c +++ b/erts/etc/common/erlexec.c @@ -1035,6 +1035,7 @@ int main(int argc, char **argv) /* This is a -S passed on command line */ process_args = 0; ADD_BOOT_CONFIG; + add_arg("-noshell"); add_arg("-S"); } else { add_arg(argv[i]); diff --git a/lib/inets/src/http_server/httpd.erl b/lib/inets/src/http_server/httpd.erl index 057e7e1903..d74c243f21 100644 --- a/lib/inets/src/http_server/httpd.erl +++ b/lib/inets/src/http_server/httpd.erl @@ -534,7 +534,7 @@ do_serve(#{address := Address, port := Port, directory := Path}) -> ), % This is needed to support random port assignment (--port 0) [{port, ActualPort}] = info(Pid, [port]), - io:fwrite("~nStarted HTTP server on http://~s:~w at ~s~n", + io:fwrite("Started HTTP server on http://~s:~w at ~s~n", [inet:ntoa(Address), ActualPort, AbsPath]), receive {From, shutdown} -> diff --git a/lib/inets/test/httpd_serve_SUITE.erl b/lib/inets/test/httpd_serve_SUITE.erl index 64890fdda0..0469498a54 100644 --- a/lib/inets/test/httpd_serve_SUITE.erl +++ b/lib/inets/test/httpd_serve_SUITE.erl @@ -222,7 +222,7 @@ wait_for_startup_line([], Unexpected, Tries) when Tries > 0 -> end, timer:sleep(?STARTUP_WAIT_NAPTIME_MS), wait_for_startup_line(ct:capture_get(), Unexpected, Tries - 1); -wait_for_startup_line(["\nStarted HTTP" ++ _Rest = Line | _Lines], _Unexpected, _Tries) -> +wait_for_startup_line(["Started HTTP" ++ _Rest = Line | _Lines], _Unexpected, _Tries) -> {ok, Line}; wait_for_startup_line([Line | Lines], Unexpected, Tries) -> wait_for_startup_line(Lines, [Line | Unexpected], Tries). @@ -232,7 +232,7 @@ wait_for_startup_line([Line | Lines], Unexpected, Tries) -> %% Started HTTP server on http://127.0.0.1:8000 at /path/to/lib/inets/make_test_dir/ct_logs/ct_run.test_server@zulu.2023-06-06_12.07.27\n" parse_startup_line(Line) -> {match, [_, RawIp, RawPort, Path]} = re:run( - Line, "^\nStarted HTTP server on http://(.+):(\\d+) at (.*)\\n$", [{capture, all, list}] + Line, "^Started HTTP server on http://(.+):(\\d+) at (.*)\\n$", [{capture, all, list}] ), {ok, Ip} = inet:parse_address(RawIp), Port = list_to_integer(RawPort), -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor