pmattes / x3270

Family of IBM 3270 emulators
47 stars 19 forks source link

QUESTION: Session file in combination with command line options #7

Closed ILoveHubGit closed 4 years ago

ILoveHubGit commented 4 years ago

Is it possible to use the command line options in combination with a session file?

We would like to start wc3270 with a specific httpd address (localhost:5000) per user but with a default set of other parameters (in Session.wc3270) wc3270 Session.wc3270 -httpd localhost:5000

Currently it looks like when a .wc3270 file is given the command line parameters are ignored.

pmattes commented 4 years ago

My apologies for taking so long to respond.

The code is supposed to work as you expect -- the session file is read, then the command-line parameters override/augment anything in the file. I'll go verify that is the case, and if it isn't, I'll fix it.

Can you tell me what version of wc3270 you are using?

pmattes commented 4 years ago

I have tested this behavior with wc3270 3.6 and 4.0. It works correctly, as far as I can tell. Can you show me what is in 'Session.wc3270'?

Also, this may be unrelated, but on Windows 10, 'localhost' is mapped to the IPv6 loopback address, ::1. So if you are expecting the command-line option '-httpd localhost:5000' to cause wc3270's httpd to bind to 127.0.0.1 (which is the default if you don't specify a hostname), it won't work as you expect.

ILoveHubGit commented 4 years ago

I'm using this version on Windows 7:

wc3270 v4.0ga9 Mon May 25 20:10:10 UTC 2020 pdm Copyright 1989-2020 by Paul Mattes, GTRC and others.

With the session manager the following information is set in the session file:

! wc3270 session 'MAINFRAME' ! Created or modified by the wc3270 v4.0ga9 Session Wizard Wed Jul 08 09:58:39 2020 wc3270.hostname: L:: wc3270.model: 4 wc3270.codePage: bracket wc3270.autoShortcut: true wc3270.verifyHostCert: false

: are actually filled with the correct data, but I can't show them here. I start wc3270 in this way: `wc3270 mysession.wc3270 -httpd localhost:5000` But after this there is no API available on localhost:5000
pmattes commented 4 years ago

Okay, I figured it out.

It's not that wc3270 is ignoring the command-line options. It's that in auto-shortcut mode, it forgets to pass the extra command-line options to the new copy of wc3270 that it runs inside the new window.

I will get this fixed ASAP.

In the meantime, there are a couple of workarounds. First, you could add this to the bottom of the session file: wc3270.autoShortcut: false (Don't change the setting at the top of the file, or you won't be able to edit it with the Session Wizard any more.)

Second, you could run wc3270 with the "+S" command-line option. This disables auto-shortcut mode (and proves that command-line options are actually recognized).

Third, if you are running from a desktop shortcut, you can add your '-httpd' option to the "Target" property of the shortcut.

pmattes commented 4 years ago

This was corrected in 4.0ga10, released yesterday.