diff options
Diffstat (limited to 'lib/kernel/src/erl_compile_server.erl')
-rw-r--r-- | lib/kernel/src/erl_compile_server.erl | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/kernel/src/erl_compile_server.erl b/lib/kernel/src/erl_compile_server.erl index f4b719068e..3910d32cac 100644 --- a/lib/kernel/src/erl_compile_server.erl +++ b/lib/kernel/src/erl_compile_server.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2019. All Rights Reserved. +%% Copyright Ericsson AB 2019-2023. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -51,8 +51,7 @@ start_link() -> init([]) -> %% We don't want the current directory in the code path. %% Remove it. - Path = [D || D <- code:get_path(), D =/= "."], - true = code:set_path(Path), + _ = code:del_path("."), Config = init_config(), {ok, #st{config=Config}, ?IDLE_TIMEOUT}. @@ -68,7 +67,7 @@ handle_call({compile, Parameters}, From, #st{jobs=Jobs}=St0) -> case verify_context(PathArgs, Parameters, St0) of {ok, St1} -> #{cwd := Cwd, encoding := Enc} = Parameters, - PidRef = spawn_monitor(fun() -> exit(do_compile(ErlcArgs, Cwd, Enc)) end), + PidRef = spawn_monitor(fun() -> exit(do_compile(ErlcArgs, unicode:characters_to_list(Cwd, Enc), Enc)) end), St = St1#st{jobs=Jobs#{PidRef => From}}, {noreply, St#st{timeout=?IDLE_TIMEOUT}}; wrong_config -> @@ -145,8 +144,9 @@ do_compile(ErlcArgs, Cwd, Enc) -> {error, StdOutput, StdErrorOutput} end. -parse_command_line(#{command_line := CmdLine, cwd := Cwd}) -> - parse_command_line_1(CmdLine, Cwd, [], []). +parse_command_line(#{command_line := CmdLine0, cwd := Cwd, encoding := Enc}) -> + CmdLine = lists:map(fun(A) -> unicode:characters_to_list(A, Enc) end, CmdLine0), + parse_command_line_1(CmdLine, unicode:characters_to_list(Cwd, Enc), [], []). parse_command_line_1(["-pa", Pa|T], Cwd, PaAcc, PzAcc) -> parse_command_line_1(T, Cwd, [Pa|PaAcc], PzAcc); |