Skip to content

Commit c722b5d

Browse files
committed
Merge pull request #10820 from mlubin/versionopt
skip julia startup when -v option is requested
2 parents 6c2f580 + 965f48e commit c722b5d

File tree

6 files changed

+4
-13
lines changed

6 files changed

+4
-13
lines changed

base/client.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,6 @@ let reqarg = Set(UTF8String["--home", "-H",
252252
global have_color = (opts.color == 1)
253253
global is_interactive = Bool(opts.isinteractive)
254254
while true
255-
# show julia VERSION and quit
256-
if Bool(opts.version)
257-
println(STDOUT, "julia version ", VERSION)
258-
exit(0)
259-
end
260-
261255
# load ~/.juliarc file
262256
startup && load_juliarc()
263257

base/options.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# NOTE: This type needs to be kept in sync with jl_options in src/julia.h
22
immutable JLOptions
3-
version::Int8
43
quiet::Int8
54
julia_home::Ptr{Cchar}
65
julia_bin::Ptr{Cchar}

src/init.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ DLLEXPORT void gdblookup(ptrint_t ip);
8484

8585
static const char system_image_path[256] = JL_SYSTEM_IMAGE_PATH;
8686

87-
jl_options_t jl_options = { 0, // version
88-
0, // quiet
87+
jl_options_t jl_options = { 0, // quiet
8988
NULL, // julia_home
9089
NULL, // julia_bin
9190
NULL, // build_path

src/julia.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1488,7 +1488,6 @@ void show_execution_point(char *filename, int lno);
14881488
// julia options -----------------------------------------------------------
14891489
// NOTE: This struct needs to be kept in sync with JLOptions type in base/options.jl
14901490
typedef struct {
1491-
int8_t version;
14921491
int8_t quiet;
14931492
const char *julia_home;
14941493
const char *julia_bin;

test/cmdlineargs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
let exename = joinpath(JULIA_HOME, Base.julia_exename())
22
# --version
33
let v = split(readall(`$exename -v`), "julia version ")[end]
4-
@test VERSION == VersionNumber(v)
4+
@test Base.VERSION_STRING == chomp(v)
55
end
66
@test readall(`$exename -v`) == readall(`$exename --version`)
77

ui/repl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ void parse_opts(int *argcp, char ***argvp)
162162
lastind = optind;
163163
break;
164164
case 'v': // version
165-
jl_options.version = 1;
166-
break;
165+
jl_printf(JL_STDOUT, "julia version %s\n", JULIA_VERSION_STRING);
166+
jl_exit(0);
167167
case 'h': // help
168168
jl_printf(JL_STDOUT, "%s%s", usage, opts);
169169
jl_exit(0);

0 commit comments

Comments
 (0)