What's the best way to run a one shot command?

Hi all,
in a rebar3 project I would like to run a one shot command, using a module mod and a function f.

I was reading the erl doc and I saw the -run switch.
I tried erl -run mod f but I got:

> erl -run mod f
Erlang/OTP 25 [erts-13.2.2.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns]

{"init terminating in do_boot",{undef,[{mod,f,[],[]},{init,start_em,1,[]},{init,do_boot,3,[]}]}}
init terminating in do_boot ({undef,[{mod,f,[],[]},{init,start_em,1,[]},{init,do_boot,3,[]}]})

Crash dump is being written to: erl_crash.dump...done

The crash dump is quite long:

=erl_crash_dump:0.5
Mon Oct 16 17:31:46 2023
Slogan: init terminating in do_boot ({undef,[{mod,f,[],[]},{init,start_em,1,[]},{init,do_boot,3,[]}]})
System version: Erlang/OTP 25 [erts-13.2.2.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns]
Taints: 
Atoms: 8976
Calling Thread: scheduler:2
=scheduler:1
Scheduler Sleep Info Flags: SLEEPING | TSE_SLEEPING | WAITING
Scheduler Sleep Info Aux Work: 
Current Port: 
Run Queue Max Length: 0
Run Queue High Length: 0
Run Queue Normal Length: 0
Run Queue Low Length: 0
Run Queue Port Length: 0
Run Queue Flags: OUT_OF_WORK | HALFTIME_OUT_OF_WORK
Current Process: 
=scheduler:2
Scheduler Sleep Info Flags: 
Scheduler Sleep Info Aux Work: 
Current Port: 
Run Queue Max Length: 0
Run Queue High Length: 0
Run Queue Normal Length: 2
Run Queue Low Length: 0
Run Queue Port Length: 0
Run Queue Flags: NONEMPTY_NORMAL | OUT_OF_WORK | HALFTIME_OUT_OF_WORK | NONEMPTY | EXEC
Current Process: <0.0.0>
Current Process State: Running
Current Process Internal State: ACT_PRIO_NORMAL | USR_PRIO_NORMAL | PRQ_PRIO_NORMAL | ACTIVE | RUNNING | ACTIVE_SYS
Current Process Program counter: 0x00007fd8c25c7ca8 (init:flatten/2 + 112)
Current Process Limited Stack Trace:
0x00007fd8c0debd28:SReturn addr 0xC2632A3C (erlang:halt/1 + 132)
0x00007fd8c0debd40:SReturn addr 0xC25C0B88 (<terminate process normally>)
=scheduler:3
Scheduler Sleep Info Flags: SLEEPING | POLL_SLEEPING | WAITING
Scheduler Sleep Info Aux Work: 
Current Port: 
Run Queue Max Length: 0
Run Queue High Length: 0
Run Queue Normal Length: 0
Run Queue Low Length: 0
Run Queue Port Length: 0
Run Queue Flags: OUT_OF_WORK | HALFTIME_OUT_OF_WORK
Current Process: 
=scheduler:4
Scheduler Sleep Info Flags: SLEEPING | TSE_SLEEPING | WAITING
Scheduler Sleep Info Aux Work: 
Current Port: 
Run Queue Max Length: 0
Run Queue High Length: 0
Run Queue Normal Length: 0
Run Queue Low Length: 0
Run Queue Port Length: 0
Run Queue Flags: OUT_OF_WORK | HALFTIME_OUT_OF_WORK
Current Process: 
=dirty_cpu_scheduler:5
Scheduler Sleep Info Flags: SLEEPING | TSE_SLEEPING | WAITING
Scheduler Sleep Info Aux Work: 
Current Process: 
=dirty_cpu_scheduler:6
Scheduler Sleep Info Flags: SLEEPING | TSE_SLEEPING | WAITING
Scheduler Sleep Info Aux Work: 
Current Process: 
=dirty_cpu_scheduler:7
Scheduler Sleep Info Flags: SLEEPING | TSE_SLEEPING | WAITING
Scheduler Sleep Info Aux Work: 
Current Process: 
=dirty_cpu_scheduler:8
Scheduler Sleep Info Flags: SLEEPING | TSE_SLEEPING | WAITING
Scheduler Sleep Info Aux Work: 
Current Process: 
=dirty_cpu_run_queue
Run Queue Max Length: 0
Run Queue High Length: 0
Run Queue Normal Length: 0
Run Queue Low Length: 0
Run Queue Port Length: 0
Run Queue Flags: OUT_OF_WORK | HALFTIME_OUT_OF_WORK
=dirty_io_scheduler:9
Scheduler Sleep Info Flags: SLEEPING | TSE_SLEEPING | WAITING
Scheduler Sleep Info Aux Work: 
Current Process: 
=dirty_io_scheduler:10
Scheduler Sleep Info Flags: SLEEPING | TSE_SLEEPING | WAITING
Scheduler Sleep Info Aux Work: 
Current Process: 
=dirty_io_scheduler:11
Scheduler Sleep Info Flags: SLEEPING | TSE_SLEEPING | WAITING
Scheduler Sleep Info Aux Work: 
Current Process: 
=dirty_io_scheduler:12
Scheduler Sleep Info Flags: SLEEPING | TSE_SLEEPING | WAITING
Scheduler Sleep Info Aux Work: 
Current Process: 
=dirty_io_scheduler:13
Scheduler Sleep Info Flags: SLEEPING | TSE_SLEEPING | WAITING
Scheduler Sleep Info Aux Work: 
Current Process: 
=dirty_io_scheduler:14
Scheduler Sleep Info Flags: SLEEPING | TSE_SLEEPING | WAITING
Scheduler Sleep Info Aux Work: 
Current Process: 
=dirty_io_scheduler:15
Scheduler Sleep Info Flags: SLEEPING | TSE_SLEEPING | WAITING
Scheduler Sleep Info Aux Work: 
Current Process: 
=dirty_io_scheduler:16
Scheduler Sleep Info Flags: SLEEPING | TSE_SLEEPING | WAITING
Scheduler Sleep Info Aux Work: 
Current Process: 
=dirty_io_scheduler:17
Scheduler Sleep Info Flags: SLEEPING | TSE_SLEEPING | WAITING
Scheduler Sleep Info Aux Work: 
Current Process: 
=dirty_io_scheduler:18
Scheduler Sleep Info Flags: SLEEPING | TSE_SLEEPING | WAITING
Scheduler Sleep Info Aux Work: 
Current Process: 
=dirty_io_run_queue
Run Queue Max Length: 0
Run Queue High Length: 0
Run Queue Normal Length: 0
Run Queue Low Length: 0
Run Queue Port Length: 0
Run Queue Flags: OUT_OF_WORK | HALFTIME_OUT_OF_WORK
=memory
total: 14242664
processes: 4086528
processes_used: 4079584
system: 10156136
atom: 270505
atom_used: 244034
binary: 7376
code: 4677174
ets: 445096
=hash_table:atom_tab
size: 8192
used: 5469
objs: 8975
depth: 6
=index_table:atom_tab
size: 9216
limit: 1048576
entries: 8976
=hash_table:module_code
size: 64
used: 52
objs: 98
depth: 4
=index_table:module_code
size: 1024
limit: 65536
entries: 98
=hash_table:export_list
size: 4096
used: 2129
objs: 3090
depth: 5
=index_table:export_list
size: 4096
limit: 524288
entries: 3090
=hash_table:export_list
size: 4096
used: 2121
objs: 3074
depth: 5
=hash_table:process_reg
size: 32
used: 19
objs: 25
depth: 3
=hash_table:fun_table
size: 512
used: 390
objs: 642
depth: 4
=hash_table:node_table
size: 16
used: 1
objs: 1
depth: 1
=hash_table:dist_table
size: 16
used: 1
objs: 1
depth: 1
=allocated_areas
sys_misc: 57816
static: 1053984
atom_space: 131104 104633
atom_table: 139401
module_table: 64152
export_table: 197028
export_list: 618000
register_table: 372
fun_table: 4210
module_refs: 4656
loaded_code: 3789128
dist_table: 643
node_table: 291
bits_bufs_size: 0
bif_timer: 0
process_table: 3145728
port_table: 786432
ets_misc: 131072
external_alloc: 3789128
=allocator:sys_alloc
option e: true
option m: libc
option tt: 131072
option tp: 0
=allocator:temp_alloc[0]
versions: 2.1 3.0
option e: true
option t: 5
option ramv: false
option atags: false
option sbct: 524288
option asbcst: 4145152
option rsbcst: 90
option rsbcmt: 80
option rmbcmt: 100
option mmbcs: 131072
option mmsbc: 256
option mmmbc: 18446744073709551615
option lmbcs: 10485760
option smbcs: 1048576
option mbcgs: 10
option acul: 0
option acful: 0
option acnl: 0
option acfml: 0
option cp: undefined
option mbsd: 3
option as: gf
mbcs blocks[sys_alloc] count: 0 0 0
mbcs blocks[sys_alloc] size: 0 0 0
mbcs blocks[temp_alloc] count: 0 5 5
mbcs blocks[temp_alloc] size: 0 11000 11000
mbcs blocks[sl_alloc] count: 0 0 0
mbcs blocks[sl_alloc] size: 0 0 0
mbcs blocks[std_alloc] count: 0 0 0
mbcs blocks[std_alloc] size: 0 0 0
mbcs blocks[ll_alloc] count: 0 0 0
mbcs blocks[ll_alloc] size: 0 0 0
mbcs blocks[eheap_alloc] count: 0 0 0
mbcs blocks[eheap_alloc] size: 0 0 0
mbcs blocks[ets_alloc] count: 0 0 0
mbcs blocks[ets_alloc] size: 0 0 0
mbcs blocks[fix_alloc] count: 0 0 0
mbcs blocks[fix_alloc] size: 0 0 0
mbcs blocks[literal_alloc] count: 0 0 0
mbcs blocks[literal_alloc] size: 0 0 0
mbcs blocks[binary_alloc] count: 0 0 0
mbcs blocks[binary_alloc] size: 0 0 0
mbcs blocks[driver_alloc] count: 0 0 0
mbcs blocks[driver_alloc] size: 0 0 0
mbcs blocks[test_alloc] count: 0 0 0
mbcs blocks[test_alloc] size: 0 0 0
mbcs carriers: 1 1 1
mbcs mseg carriers: 0
mbcs sys_alloc carriers: 1
mbcs carriers size: 131072 131072 131072
mbcs mseg carriers size: 0
mbcs sys_alloc carriers size: 131072
sbcs blocks[sys_alloc] count: 0 0 0
sbcs blocks[sys_alloc] size: 0 0 0
sbcs blocks[temp_alloc] count: 0 0 0
sbcs blocks[temp_alloc] size: 0 0 0
sbcs blocks[sl_alloc] count: 0 0 0
sbcs blocks[sl_alloc] size: 0 0 0
sbcs blocks[std_alloc] count: 0 0 0
sbcs blocks[std_alloc] size: 0 0 0
sbcs blocks[ll_alloc] count: 0 0 0
sbcs blocks[ll_alloc] size: 0 0 0
sbcs blocks[eheap_alloc] count: 0 0 0
sbcs blocks[eheap_alloc] size: 0 0 0
sbcs blocks[ets_alloc] count: 0 0 0
sbcs blocks[ets_alloc] size: 0 0 0
sbcs blocks[fix_alloc] count: 0 0 0
sbcs blocks[fix_alloc] size: 0 0 0
sbcs blocks[literal_alloc] count: 0 0 0
sbcs blocks[literal_alloc] size: 0 0 0
sbcs blocks[binary_alloc] count: 0 0 0
sbcs blocks[binary_alloc] size: 0 0 0
sbcs blocks[driver_alloc] count: 0 0 0
sbcs blocks[driver_alloc] size: 0 0 0
sbcs blocks[test_alloc] count: 0 0 0
sbcs blocks[test_alloc] size: 0 0 0
sbcs carriers: 0 0 0
sbcs mseg carriers: 0
sbcs sys_alloc carriers: 0
sbcs carriers size: 0 0 0
sbcs mseg carriers size: 0
sbcs sys_alloc carriers size: 0
temp_alloc calls: 923
temp_free calls: 923
temp_realloc calls: 0
mseg_alloc calls: 0
mseg_dealloc calls: 0
mseg_realloc calls: 0
sys_alloc calls: 1
sys_free calls: 0
sys_realloc calls: 0
=allocator:temp_alloc[1]
versions: 0.9 3.0
option e: true
option t: 5
option ramv: false
option atags: false
option sbct: 524288
option asbcst: 4145152
option rsbcst: 90
option rsbcmt: 80
option rmbcmt: 100
option mmbcs: 131072
option mmsbc: 256
option mmmbc: 18446744073709551615
option lmbcs: 10485760
option smbcs: 1048576
option mbcgs: 10
option acul: 0
option acful: 0
option acnl: 0
option acfml: 0
option cp: undefined
option as: af
mbcs blocks[sys_alloc] count: 0 0 0
mbcs blocks[sys_alloc] size: 0 0 0
mbcs blocks[temp_alloc] count: 0 4 4
mbcs blocks[temp_alloc] size: 0 11768 11768
mbcs blocks[sl_alloc] count: 0 0 0
mbcs blocks[sl_alloc] size: 0 0 0
mbcs blocks[std_alloc] count: 0 0 0
mbcs blocks[std_alloc] size: 0 0 0
mbcs blocks[ll_alloc] count: 0 0 0
mbcs blocks[ll_alloc] size: 0 0 0
mbcs blocks[eheap_alloc] count: 0 0 0
mbcs blocks[eheap_alloc] size: 0 0 0
mbcs blocks[ets_alloc] count: 0 0 0
mbcs blocks[ets_alloc] size: 0 0 0
mbcs blocks[fix_alloc] count: 0 0 0
mbcs blocks[fix_alloc] size: 0 0 0
mbcs blocks[literal_alloc] count: 0 0 0
mbcs blocks[literal_alloc] size: 0 0 0
mbcs blocks[binary_alloc] count: 0 0 0
mbcs blocks[binary_alloc] size: 0 0 0
mbcs blocks[driver_alloc] count: 0 0 0
mbcs blocks[driver_alloc] size: 0 0 0
mbcs blocks[test_alloc] count: 0 0 0
mbcs blocks[test_alloc] size: 0 0 0
mbcs carriers: 1 1 1
mbcs mseg carriers: 0
mbcs sys_alloc carriers: 1
mbcs carriers size: 131072 131072 131072
mbcs mseg carriers size: 0
mbcs sys_alloc carriers size: 131072
sbcs blocks[sys_alloc] count: 0 0 0
sbcs blocks[sys_alloc] size: 0 0 0
sbcs blocks[temp_alloc] count: 0 0 0
sbcs blocks[temp_alloc] size: 0 0 0
sbcs blocks[sl_alloc] count: 0 0 0
sbcs blocks[sl_alloc] size: 0 0 0
sbcs blocks[std_alloc] count: 0 0 0
sbcs blocks[std_alloc] size: 0 0 0
sbcs blocks[ll_alloc] count: 0 0 0
sbcs blocks[ll_alloc] size: 0 0 0
sbcs blocks[eheap_alloc] count: 0 0 0
sbcs blocks[eheap_alloc] size: 0 0 0
sbcs blocks[ets_alloc] count: 0 0 0
sbcs blocks[ets_alloc] size: 0 0 0
sbcs blocks[fix_alloc] count: 0 0 0
sbcs blocks[fix_alloc] size: 0 0 0
sbcs blocks[literal_alloc] count: 0 0 0
sbcs blocks[literal_alloc] size: 0 0 0
sbcs blocks[binary_alloc] count: 0 0 0
sbcs blocks[binary_alloc] size: 0 0 0
sbcs blocks[driver_alloc] count: 0 0 0
sbcs blocks[driver_alloc] size: 0 0 0
sbcs blocks[test_alloc] count: 0 0 0
sbcs blocks[test_alloc] size: 0 0 0
sbcs carriers: 0 0 0
sbcs mseg carriers: 0
sbcs sys_alloc carriers: 0
sbcs carriers size: 0 0 0
sbcs mseg carriers size: 0
sbcs sys_alloc carriers size: 0
temp_alloc calls: 1186
temp_free calls: 1186
temp_realloc calls: 0
mseg_alloc calls: 0
mseg_dealloc calls: 0
mseg_realloc calls: 0
sys_alloc calls: 1
sys_free calls: 0
sys_realloc calls: 0
=allocator:temp_alloc[2]
versions: 0.9 3.0
option e: true
option t: 5
option ramv: false
option atags: false
option sbct: 524288
option asbcst: 4145152
option rsbcst: 90
option rsbcmt: 80
option rmbcmt: 100
option mmbcs: 131072
option mmsbc: 256
option mmmbc: 18446744073709551615
option lmbcs: 10485760
option smbcs: 1048576
option mbcgs: 10
option acul: 0
option acful: 0
option acnl: 0
option acfml: 0
option cp: undefined
option as: af
mbcs blocks[sys_alloc] count: 0 0 0
mbcs blocks[sys_alloc] size: 0 0 0
mbcs blocks[temp_alloc] count: 1 6 6
mbcs blocks[temp_alloc] size: 65544 65544 65544
mbcs blocks[sl_alloc] count: 0 0 0
mbcs blocks[sl_alloc] size: 0 0 0
mbcs blocks[std_alloc] count: 0 0 0
mbcs blocks[std_alloc] size: 0 0 0
mbcs blocks[ll_alloc] count: 0 0 0
mbcs blocks[ll_alloc] size: 0 0 0
mbcs blocks[eheap_alloc] count: 0 0 0
mbcs blocks[eheap_alloc] size: 0 0 0
mbcs blocks[ets_alloc] count: 0 0 0
mbcs blocks[ets_alloc] size: 0 0 0
mbcs blocks[fix_alloc] count: 0 0 0
mbcs blocks[fix_alloc] size: 0 0 0
mbcs blocks[literal_alloc] count: 0 0 0
mbcs blocks[literal_alloc] size: 0 0 0
mbcs blocks[binary_alloc] count: 0 0 0
mbcs blocks[binary_alloc] size: 0 0 0
mbcs blocks[driver_alloc] count: 0 0 0
mbcs blocks[driver_alloc] size: 0 0 0
mbcs blocks[test_alloc] count: 0 0 0
mbcs blocks[test_alloc] size: 0 0 0
mbcs carriers: 1 1 1
mbcs mseg carriers: 0
mbcs sys_alloc carriers: 1
mbcs carriers size: 131072 131072 131072
mbcs mseg carriers size: 0
mbcs sys_alloc carriers size: 131072
sbcs blocks[sys_alloc] count: 0 0 0
sbcs blocks[sys_alloc] size: 0 0 0
sbcs blocks[temp_alloc] count: 0 0 0
sbcs blocks[temp_alloc] size: 0 0 0
sbcs blocks[sl_alloc] count: 0 0 0
sbcs blocks[sl_alloc] size: 0 0 0
sbcs blocks[std_alloc] count: 0 0 0
sbcs blocks[std_alloc] size: 0 0 0
sbcs blocks[ll_alloc] count: 0 0 0
sbcs blocks[ll_alloc] size: 0 0 0
sbcs blocks[eheap_alloc] count: 0 0 0
sbcs blocks[eheap_alloc] size: 0 0 0
sbcs blocks[ets_alloc] count: 0 0 0
sbcs blocks[ets_alloc] size: 0 0 0
sbcs blocks[fix_alloc] count: 0 0 0
sbcs blocks[fix_alloc] size: 0 0 0
sbcs blocks[literal_alloc] count: 0 0 0
sbcs blocks[literal_alloc] size: 0 0 0
sbcs blocks[binary_alloc] count: 0 0 0
sbcs blocks[binary_alloc] size: 0 0 0
sbcs blocks[driver_alloc] count: 0 0 0
sbcs blocks[driver_alloc] size: 0 0 0
sbcs blocks[test_alloc] count: 0 0 0
sbcs blocks[test_alloc] size: 0 0 0
sbcs carriers: 0 0 0
sbcs mseg carriers: 0
sbcs sys_alloc carriers: 0
sbcs carriers size: 0 0 0
sbcs mseg carriers size: 0
sbcs sys_alloc carriers size: 0
temp_alloc calls: 4912
temp_free calls: 4911
temp_realloc calls: 11
mseg_alloc calls: 0
mseg_dealloc calls: 0
mseg_realloc calls: 0
sys_alloc calls: 1
sys_free calls: 0
sys_realloc calls: 0
=allocator:temp_alloc[3]
versions: 0.9 3.0
option e: true
option t: 5
option ramv: false
option atags: false
option sbct: 524288
option asbcst: 4145152
option rsbcst: 90
option rsbcmt: 80
option rmbcmt: 100
option mmbcs: 131072
option mmsbc: 256
option mmmbc: 18446744073709551615
option lmbcs: 10485760
option smbcs: 1048576
option mbcgs: 10
option acul: 0
option acful: 0
option acnl: 0
option acfml: 0
option cp: undefined
option as: af
mbcs blocks[sys_alloc] count: 0 0 0
mbcs blocks[sys_alloc] size: 0 0 0
mbcs blocks[temp_alloc] count: 0 1 1
mbcs blocks[temp_alloc] size: 0 56 56
mbcs blocks[sl_alloc] count: 0 0 0
mbcs blocks[sl_alloc] size: 0 0 0
mbcs blocks[std_alloc] count: 0 0 0
mbcs blocks[std_alloc] size: 0 0 0
mbcs blocks[ll_alloc] count: 0 0 0
mbcs blocks[ll_alloc] size: 0 0 0
mbcs blocks[eheap_alloc] count: 0 0 0
mbcs blocks[eheap_alloc] size: 0 0 0
mbcs blocks[ets_alloc] count: 0 0 0
mbcs blocks[ets_alloc] size: 0 0 0
mbcs blocks[fix_alloc] count: 0 0 0
mbcs blocks[fix_alloc] size: 0 0 0
mbcs blocks[literal_alloc] count: 0 0 0
mbcs blocks[literal_alloc] size: 0 0 0
mbcs blocks[binary_alloc] count: 0 0 0
mbcs blocks[binary_alloc] size: 0 0 0
mbcs blocks[driver_alloc] count: 0 0 0
mbcs blocks[driver_alloc] size: 0 0 0
mbcs blocks[test_alloc] count: 0 0 0
mbcs blocks[test_alloc] size: 0 0 0
mbcs carriers: 1 1 1
mbcs mseg carriers: 0
mbcs sys_alloc carriers: 1
mbcs carriers size: 131072 131072 131072
mbcs mseg carriers size: 0
mbcs sys_alloc carriers size: 131072
sbcs blocks[sys_alloc] count: 0 0 0
sbcs blocks[sys_alloc] size: 0 0 0
sbcs blocks[temp_alloc] count: 0 0 0
sbcs blocks[temp_alloc] size: 0 0 0
sbcs blocks[sl_alloc] count: 0 0 0
sbcs blocks[sl_alloc] size: 0 0 0
sbcs blocks[std_alloc] count: 0 0 0
sbcs blocks[std_alloc] size: 0 0 0
sbcs blocks[ll_alloc] count: 0 0 0
sbcs blocks[ll_alloc] size: 0 0 0
sbcs blocks[eheap_alloc] count: 0 0 0
sbcs blocks[eheap_alloc] size: 0 0 0
sbcs blocks[ets_alloc] count: 0 0 0
sbcs blocks[ets_alloc] size: 0 0 0
sbcs blocks[fix_alloc] count: 0 0 0
sbcs blocks[fix_alloc] size: 0 0 0
sbcs blocks[literal_alloc] count: 0 0 0
sbcs blocks[literal_alloc] size: 0 0 0
sbcs blocks[binary_alloc] count: 0 0 0
sbcs blocks[binary_alloc] size: 0 0 0
sbcs blocks[driver_alloc] count: 0 0 0
sbcs blocks[driver_alloc] size: 0 0 0
sbcs blocks[test_alloc] count: 0 0 0
sbcs blocks[test_alloc] size: 0 0 0
sbcs carriers: 0 0 0
sbcs mseg carriers: 0
sbcs sys_alloc carriers: 0
sbcs carriers size: 0 0 0
sbcs mseg carriers size: 0
sbcs sys_alloc carriers size: 0
temp_alloc calls: 1
temp_free calls: 1
temp_realloc calls: 0
mseg_alloc calls: 0
mseg_dealloc calls: 0
mseg_realloc calls: 0
sys_alloc calls: 1
sys_free calls: 0
sys_realloc calls: 0
=allocator:temp_alloc[4]
versions: 0.9 3.0
option e: true
option t: 5
option ramv: false
option atags: false
option sbct: 524288
option asbcst: 4145152
option rsbcst: 90
option rsbcmt: 80
option rmbcmt: 100
option mmbcs: 131072
option mmsbc: 256
option mmmbc: 18446744073709551615
option lmbcs: 10485760
option smbcs: 1048576
option mbcgs: 10
option acul: 0
option acful: 0
option acnl: 0
option acfml: 0
option cp: undefined
option as: af
...MUCH MORE LINES...
throw
return
call
normal
timeout
infinity
''
'$end_of_table'
'nonode@nohost'
'_'
true
false
=end

What am I doing wrong here?

Cheers!

in a rebar3 project I would like to run a one shot command, using a module mod and a function f.

I was reading the erl doc and I saw the -run switch.
I tried erl -run mod f but I got:

erl -run mod f
Erlang/OTP 25 [erts-13.2.2.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns]

{"init terminating in do_boot",{undef,[{mod,f,[],[]},{init,start_em,1,[]},{init,do_boot,3,[]}]

You forgot to tell erl where to find your code mod.beam. Try erl -pa path/to/ebin/ -run mod f (presumably that will be under _build/ since you mentioned rebar3).

Thank you.
I have tried and got:

> erl -pa ./_build/default/lib/adm/ebin/ -run mod f
Erlang/OTP 25 [erts-13.2.2.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns]

Eshell V13.2.2.3  (abort with ^G)
1>

So I tried with -noshell and got it hanging:

> erl -pa ./_build/default/lib/adm/ebin/ -noshell -run mod f

Of course the function works fine

"o/"

Cheers

With -noshell you need to erlang:halt() somewhere, either by calling halt(0) in your module, or by appending -run erlang halt to the erl command.

It works, thank you

Just in case you ever need it, on a rebar3 project, you can do…

$ erl -pa `rebar3 path`

…instead of manually specifying the path.

3 Likes

Handy! Thanks a lot