CHICAGO (AP) — Giovanny Gallegos came in to a sticky situation, with the St. Louis Cardinals clinging to a one-run lead and two on in the seventh inning. It quickly became a heated one.

Umpire Joe West ordered him to switch caps because there apparently was sunscreen on the bill. Manager Mike Shildt, thinking his player was unfairly singled out, got ejected during an animated argument.

That overshadowed everything else in the Cardinals' 4-0 victory over the Chicago White Sox on Wednesday.

“This is baseball's dirty little secret, and it's the wrong time and the wrong arena to expose it,” Shildt said. “Here's the deal. First of all, Gio wears the same hat all year. Hats accrue dirt. Hats accrue substances. ... Did Gio have some sunscreen at some point in his career to make sure he doesn't get some kind of melanoma? Possibly. Does he use rosin to help out? Possibly. Are these things that baseball really wants to crack down on? No.”

Tommy Edman homered twice, and the Cardinals avoided a three-game sweep.

Shildt was ejected with one out in the seventh, after Génesis Cabrera hit Yoán Moncada, putting runners on first and second.

The Cardinals brought in Giovanny Gallegos. West, who on Tuesday set Major League Baseball’s record for most games umpired, said second-base ump Dan Bellino noticed a substance on the brim of the pitcher's cap.

West said Gallegos told him it was sunscreen. Even so, he made the pitcher switch caps before throwing a pitch because “we don’t want anybody to be accused of cheating or any of that stuff.” The cap was sent to the commissioner's office.

“The whole point of this is we’re trying to protect his pitcher, and he got ejected,” West said.

Shildt, who was tossed for the second time this season, said he appreciated the motivation. But he questioned why there was enforcement.

“Let's go check the guys that are sitting there going into their glove every day with filthy stuff coming out, not some guy before he even steps on the mound with a spot on his hat,” he said.

Once the situation cooled, Gallegos squashed the threat, striking out AL MVP José Abreu and Mercedes.

GOING DEEP

Edman connected against Carlos Rodón (5-2) in the third and Aaron Bummer in the eighth for a 2-0 lead. Edmundo Sosa added a two-run single in the ninth, and the NL Central-leading Cardinals came away with the win after losing four of five.

John Gant (3-2) dodged bases-loaded jams in the first and third innings while pitching into the sixth.

The Cardinals committed two errors, raising their series total to seven, yet managed to stop a five-game road losing streak.

St. Louis also denied White Sox skipper Tony La Russa a sweep in his first series managing against St. Louis, the franchise the Hall of Famer guided two World Series championships from 1996 to 2011.

RODON DELIVERS

Rodón came through with another solid start, giving up one hit in six innings. The left-hander struck out 10 after whiffing a career-high 13 against the New York Yankees last week and did not walk a batter, though he hit two.

“He was outstanding,” La Russa said. “A continuation of what he's done all year.”

AL Central-leading Chicago was 0 for 10 with runners in scoring position.

Gant gave up five hits and walked three. The right-hander exited after Andrew Vaughn reached on a throwing error by third baseman Max Moroff leading off the sixth.

TRAINER'S ROOM

Cardinals: LHP Andrew Miller remains on track for a second rehab appearance Thursday with Triple-A Memphis after throwing a scoreless inning for the minor league club on Tuesday, Shildt said. ... RHP Miles Mikolas (strained right forearm) was being examined Wednesday by Dr. James Andrews. “Hopefully, everything checks out as we expect and it's favorable news,” Shildt said. ... OF Tyler O’Neill (fractured middle finger) is expected to return during the Cardinals’ current 10-game trip, though Shildt wouldn't say when the team expects to activate him. “He's definitely heading in a really good direction,” Shildt said.

White Sox: RHP Michael Kopech (left hamstring soreness) and RF Adam Eaton (tightness in right hamstring) are day to day. Kopech fell throwing the final pitch in the seventh and walked off gingerly. Eaton exited after the fifth.

UP NEXT

Cardinals: St. Louis begins a four-game series at struggling Arizona, with RHP Carlos Martínez (3-4, 4.18 ERA) starting for the Cardinals and RHP Matt Peacock (1-1, 4.91) pitching for the Diamondbacks.

White Sox: RHP Dylan Cease (2-1, 3.18) looks to bounce back from a loss to the New York Yankees as the White Sox open a four-game series against Baltimore. LHP Bruce Zimmermann (2-3, 5.59) gets the ball for the Orioles.

___

More AP MLB: https://apnews.com/MLB and https://twitter.com/AP_Sports