-
-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix cargo-pgrx and pgrx-tests on Windows #1934
base: develop
Are you sure you want to change the base?
Conversation
|
43cc5ca
to
e07355c
Compare
It seems that https://patchwork.kernel.org/project/linux-hardening/patch/20180416175918.GA13494@beast/ breaks |
7a70740
to
8befc9f
Compare
The process is explained in the official documentation: https://www.postgresql.org/docs/16/install-windows.html Not a Windows user for years, but can help if you're stuck with something (: |
I'm curious if there are really any Windows developers. So, I'm planning to leave this feature here to see if anyone fixes it. |
👀 reviews? |
this branch works like a charm on windows with MSVC installed and the updated line in |
oh cool! |
That's basically the real review this thing needed, let me check the code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good overall but it should use the std::env::consts
instead of all these cfg
s.
let so_ext = 'so_ext: { | ||
if cfg!(target_os = "macos") { | ||
break 'so_ext "dylib"; | ||
} | ||
if cfg!(target_os = "windows") { | ||
break 'so_ext "dll"; | ||
} | ||
"so" | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let so_ext = 'so_ext: { | |
if cfg!(target_os = "macos") { | |
break 'so_ext "dylib"; | |
} | |
if cfg!(target_os = "windows") { | |
break 'so_ext "dll"; | |
} | |
"so" | |
}; | |
let so_ext = std::env::consts::DLL_EXTENSION; |
if runas.is_some() { | ||
eyre::bail!("`--runas` is not supported on Windows"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this seems better than trying to reimplement the equivalent for now.
} | ||
("lib", "so") | ||
}; | ||
Ok(format!("{prefix}{}.{}", lib_name.replace('-', "_"), extension)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok(format!("{prefix}{}.{}", lib_name.replace('-', "_"), extension)) | |
use std::env::consts::{DLL_PREFIX, DLL_SUFFIX}; | |
Ok(format!("{DLL_PREFIX}{name}{DLL_SUFFIX}", name = lib_name.replace('-', "_"))) |
#[cfg(not(target_os = "windows"))] | ||
path.push("dropdb"); | ||
#[cfg(target_os = "windows")] | ||
path.push("dropdb.exe"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of this, can we get format!("dropdb{EXE_SUFFIX}")
and so on?
#[cfg(not(target_os = "windows"))] | |
path.push("dropdb"); | |
#[cfg(target_os = "windows")] | |
path.push("dropdb.exe"); | |
#[cfg(not(target_os = "windows"))] | |
path.push("dropdb"); | |
#[cfg(target_os = "windows")] | |
path.push("dropdb.exe"); |
Exactly how you thread in the consts I'm not inclined to argue... you'll note I used two different forms in the above suggestions, you can pick one you prefer or use both and add a third... just asking to use them when they're available. |
Notes:
postgres
directly to starting postgres bypg_ctl
in testingpgrx-cshim.c
is compiled with-flto
: without this flag,pgrx_embed.exe
is linked topostgres.exe
PgLwLock
andPgAtomic
but introduces a breaking change aboutPgLwLock
andPgAtomic
: name must be provided atPgLwLock/PgAtomic::new
,PgLwLock::from_named
is removed and a parameter ofPgLwLock::attach
changescargo pgrx run
andcargo pgrx test
always print logs forpg_ctl start
on Windows (pipes generated bystd::process::Command
are leaked to postgres, a command withStdio::piped()
hangs, so we useStdio::inherit()
on Windows)